package com.pentofab.payrollmanagement.application;

import javafx.fxml.FXMLLoader;

import com.pentofab.payrollmanagement.dao.AttendanceDao;
import com.pentofab.payrollmanagement.dao.EmployeeDao;
import com.pentofab.payrollmanagement.dao.LeaveDAO;
import com.pentofab.payrollmanagement.dao.SalaryDAO;
import com.pentofab.payrollmanagement.dao.UserAccountsDao;
import com.pentofab.payrollmanagement.dao.impl.AttendanceDaoImpl;
import com.pentofab.payrollmanagement.dao.impl.EmployeeDaoImpl;
import com.pentofab.payrollmanagement.dao.impl.LeaveDAOImpl;
import com.pentofab.payrollmanagement.dao.impl.SalaryDAOImpl;
import com.pentofab.payrollmanagement.dao.impl.UserAccountsDaoImpl;
import com.pentofab.payrollmanagement.ui.controller.AddCompanyUIController;
import com.pentofab.payrollmanagement.ui.controller.AddDepartmentUIController;
import com.pentofab.payrollmanagement.ui.controller.AddDesignationUIController;
import com.pentofab.payrollmanagement.ui.controller.AddEmpCategoryUIController;
import com.pentofab.payrollmanagement.ui.controller.AddEmployeeUIController;
import com.pentofab.payrollmanagement.ui.controller.AttendanceController;
import com.pentofab.payrollmanagement.ui.controller.MainController;

public class PayrollApplicationFactory {

	private static AttendanceDao attandanceMgmt = null;
	private static EmployeeDao employeeMgmt = null;
	private static LeaveDAO leaveMgmt = null;
	private static UserAccountsDao userAccountsDao =null;
	private static SalaryDAO salaryDAO =null;
	

	private static MainController mainController;

	public static AttendanceDao getAttandanceMgmt() {
		if (attandanceMgmt == null) {
			attandanceMgmt = new AttendanceDaoImpl();
		}
		return attandanceMgmt;
	}

	public static EmployeeDao getEmployeeMgmt() {
		if (employeeMgmt == null) {
			employeeMgmt = new EmployeeDaoImpl();
		}
		return employeeMgmt;
	}
	public static UserAccountsDao getUserAccountsDao() {
		if (userAccountsDao == null) {
			userAccountsDao = new UserAccountsDaoImpl();
		}
		return userAccountsDao;
	}
	
	public static LeaveDAO getLeaveDAO() {
		if (leaveMgmt == null) {
			leaveMgmt = new LeaveDAOImpl();
		}
		return leaveMgmt;
	}

	
	public static SalaryDAO getSalaryDAO() {
		
		if (salaryDAO == null) {
			salaryDAO = new SalaryDAOImpl();
		}
		return salaryDAO;
	}
	public static MainController getMainController() {
		if (mainController == null) {
			try {
				FXMLLoader loader = new FXMLLoader();
				loader.load(loader.getClass().getResourceAsStream(
						"/fxml/Main.fxml"));
				mainController = (MainController) loader.getController();
			} catch (Exception e) {
				e.printStackTrace();
			}
		}

		return mainController;
	}
}
